package com.webchat.chat.model;

import com.webchat.chat.core.enums.UserAccountType;
import com.webchat.chat.core.tools.BaseModel;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;

@Table(name = "role")
public class Role extends BaseModel implements Serializable {

    /**
     * 租户代号
     */
    @Column(name = "TENANT_CODE")
    private String tenantCode;


    /**
     * 角色名
     */
    @Column(name = "ROLE_NAME")
    private String roleName;

    /**
     * 角色类型
     */
    @Column(name = "ROLE_TYPE")
    private UserAccountType roleType;


    @Transient
    private List<Permission> permissions;

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    /**
     * 获取角色名
     *
     * @return ROLE_NAME - 角色名
     */
    public String getRoleName() {
        return roleName;
    }

    /**
     * 设置角色名
     *
     * @param roleName 角色名
     */
    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    /**
     * 获取角色类型
     *
     * @return ROLE_TYPE - 角色类型
     */
    public UserAccountType getRoleType() {
        return roleType;
    }

    /**
     * 设置角色类型
     *
     * @param roleType 角色类型
     */
    public void setRoleType(UserAccountType roleType) {
        this.roleType = roleType;
    }

    @Override
    public String toString() {
        return "Role{" +
                "tenantCode='" + tenantCode + '\'' +
                ", roleName='" + roleName + '\'' +
                ", roleType=" + roleType +
                '}';
    }
}